import { createWebHistory, createRouter } from 'vue-router'
import login from '../vitws/login.vue'
import xq from '../vitws/xq.vue'
import xqy from '../vitws/xqy.vue'
import homea from '../vitws/home/homea.vue'
import homeb from '../vitws/home/homeb.vue'
import homec from '../vitws/home/homec.vue'
import zhi from '../zhi.vue'
const routes = [
    { path: '/', redirect: '/login' },
    { path: '/login', component: login },
    { path: '/xq', component: xq },
    { path: '/xqy', component: xqy },
    { path: '/zhi', component: zhi },
    {
        path: '/homea', component: homea,
        children: [
            { path: 'homeb', component: homeb },
            { path: 'homec', component: homec },
        ]
    },
]
const router = createRouter({
    history: createWebHistory(),
    routes,
})
// router.beforeEach((to, from) => {
//   if(to.fullPath !== '/login'){
//     let token = localStorage.getItem('token')
//     if(!token){
//         return '/login'
//     }
//   }
// })
export default router